<template>
  <div class="container-start1">
    <div class="container-start1__top">
      <div class="container-start1__top__bgImg">
        <div class="container-start1__top__bgImg__one"></div>
        <div class="container-start1__top__bgImg__two"></div>
      </div>
      <div class="container-start1__top__one">健康生活</div>
      <div class="container-start1__top__two">
        健康饮食,正常作息,还自己一个好身体
      </div>
    </div>
    <div class="container-start1__mid">
      <div class="container-start1__mid__two">
        <img :src="bgImgObj[startCount].one" alt="" />
      </div>
      <div class="container-start1__mid__one">
        <img :src="bgImgObj[startCount].two" alt="" />
      </div>
    </div>
    <div class="container-start1__bottom">
      <button
        class="container-start1__bottom__left"
        v-if="startCount"
        @click="clickPreviousPage"
      >
        上一页
      </button>
      <button class="container-start1__bottom__right" @click="clickNextPage">
        下一页
      </button>
    </div>
  </div>
</template>
<script setup>
import { ref } from "vue";
import { useRouter } from "vue-router";

const startCount = ref(0);
const router = useRouter();
const bgImgObj = ref([
  {
    one: "/src/image/v2_qg2u5i.png",
    two: "/src/image/v2_qg2u55.png",
  },
  {
    one: "/src/image/v2_qg2uje.png",
    two: "/src/image/v2_qg2uiv.png",
  },
  {
    one: "/src/image/v2_qg2ukr.png",
    two: "/src/image/v2_qg2ukj.png",
  },
]);

function clickPreviousPage() {
  startCount.value--;
}

function clickNextPage() {
  if (startCount.value < 2) {
    startCount.value++;
  } else {
    router.push({
      path: "/mine",
      //  禁止返回界面
      replace: true,
    });
  }
}
</script>
<style lang="scss" scoped>
.container-start1 {
  width: 414rem;
  min-height: 706rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  padding-bottom: 50rem;
  position: relative;
  overflow: hidden;
  &__top {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: 80rem;
    width: 414rem;
    box-sizing: border-box;
    position: relative;
    padding-top: 120px;
    &__bgImg {
      div {
        background-color: #eeedf2;
        border-radius: 50%;
        position: absolute;
      }
      &__one {
        width: 33px;
        height: 33px;
        left: 20px;
        top: 20px;
      }
      &__two {
        width: 200px;
        height: 200px;
        right: -100px;
        top: -100px;
      }
    }
    &__one {
      font-size: large;
      font-weight: bold;
      margin-bottom: 10rem;
    }
    &__two {
      color: #999;
    }
  }
  &__mid {
    position: relative;
    &__one {
      img {
        width: 350rem;
        height: 220rem;
      }
    }
    &__two {
      position: absolute;
      left: 40%;
      transform: translate(-50%);
      img {
        width: 200rem;
        height: 250rem;
      }
    }
  }
  &__bottom {
    width: 100%;
    height: 35px;
    position: relative;
    box-sizing: border-box;
    button {
      width: 70rem;
      height: 35rem;
      background-color: #f3f3f3c0;
      box-shadow: 0 3rem 5rem #d9cfcfa5;
      position: absolute;
    }
    &__left {
      left: 20px;
    }
    &__right {
      right: 20px;
    }
  }
}
</style>
